input_long = int(input("请输入边长:"))
for row in range(1,input_long+1):
    if row == 1 or row == input_long:
        print('*'*input_long)
    else:
        print('*'+' '*(input_long-2)+'*')
